<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Json.stringify方法的缺陷</title>
</head>
<body>
  <script>
    var obj = {
      name: 'ysy',
      age: '18',
      handsome: true,
      friends: ['Kate', 'Bob', 'Mike'],
      hobby: {
        hobby1: 'smoking',
        hobby2: 'LOL',
        special: {
          girl: 'luoli'
        }
      },
      made: function () {
        console.log('made in china')
      },
      birthday: new Date('1995/07/12')
    }
    const obj2 = structuredClone()
    function deepCopy(obj1) {
      var copyObj = JSON.parse(JSON.stringify(obj1))
      return copyObj
    }
    var result = deepCopy(obj)
    console.log('JSON深拷贝', result)
    // 1.日期格式被转化为字符串了
    // 2.undefined,任意的函数以及symbol值，在序列化过程中会被忽略
    // 3.
  </script>
</body>
</html>